<!DOCTYPE html>
<html lang="en"
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
    <meta charset="UTF-8">
    <title>图书管理系统</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
    <style>
        nav {
            font-size: 1.5rem;
            background-color: #21D4FD;
            background-image: -webkit-linear-gradient(19deg, #21D4FD 0%, #B721FF 100%);
            background-image: -moz-linear-gradient(19deg, #21D4FD 0%, #B721FF 100%);
            background-image: -o-linear-gradient(19deg, #21D4FD 0%, #B721FF 100%);
            background-image: linear-gradient(19deg, #21D4FD 0%, #B721FF 100%);
        }
        h1 {
            font-size: 2rem;
            color: white;
        }
        li {
            margin: 10px 20px;
        }
        #searchBox {
            width: 300px;
            float: right;
        }
    </style>
</head>
<body>
<nav class="navbar navbar-expand-sm bg-primary navbar-dark">
    <ul class="navbar-nav">
        <li>
            <h1><a style="color: white; text-decoration: none" th:href="@{/}">博客管理系统</a></h1>
        </li>
        <li class="nav-item">
            <a class="nav-link active" th:href="@{/admin/book/getAll}">博客管理</a>
        </li>
        <li class="nav-item">
            <a class="nav-link" th:href="@{/admin/reader/getAll}">博客类别管理</a>
        </li>
        <li class="nav-item">
            <a class="nav-link" th:href="@{/admin/record/getAll}">评论管理</a>
        </li>
        <li class="nav-item">
            <a class="nav-link" th:href="@{/admin/record/getAll}">用户信息管理</a>
        </li>
        <li class="nav-item">
            <a class="nav-link" th:href="@{/admin/record/getAll}">广告商管理</a>
        </li>
        <li class="nav-item">
            <a class="nav-link" th:href="@{/admin/record/getAll}">标签管理</a>
        </li>
    </ul>
    <div class="text-white" style="font-size: medium; position: absolute; bottom: 30px; right: 40px">
        <div class="dropdown">
            <a class="dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
               th:text="${session.name}+', 您好'">
            </a>
            <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                <a class="dropdown-item" th:href="@{/user/toInfoPage}" sec:authorize="hasRole('USER')">个人信息</a>
                <a class="dropdown-item" th:href="@{/toChPwdPage}">修改密码</a>
                <a class="dropdown-item" th:href="@{/logout}">注销</a>
            </div>
        </div>
    </div>
</nav>

<div class="container" style="margin-top: 40px">
    <a th:href="@{/admin/book/toAddPage}" class="btn btn-outline-primary btn-lg">添&nbsp;&nbsp;&nbsp;&nbsp;加</a>
    <a th:href="@{/admin/book/getAll}" class="btn btn-link text-muted">全部博客</a>
    <form th:action="@{/admin/book/search}" id="searchBox">
        <div class="input-group">
            <input type="text" class="form-control" placeholder="输入关键词..." name="keyword">
            <input type="submit" class="input-group-append btn btn-success" value="搜  索">
        </div>
    </form>
    <div style="clear: both"></div>
    <table class="table table-hover" style="margin-top: 20px">
        <thead>
        <tr>
            <th>博客名称</th>
            <th>作者</th>
            <th>博客简要内容</th>
            <th>标签</th>
            <th>赞助广告商</th>
            <th></th>
            <th></th>
            <th></th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="blog, bookStat: ${blogs}">
            <td th:text="${blog.getName()}"></td>
            <td th:text="${blog.getAuthor()}"></td>
            <td th:text="${blog.getSimplecontext()}"></td>
            <td th:text="${blog.getLabel()}"></td>
            <td th:text="${blog.getAdversiting()}"></td>
            <td><a th:href="@{'/admin/book/info/' + ${blog.getBookId()}}" class="btn btn-outline-success">详情</a></td>
            <td><a th:href="@{'/admin/book/toEditPage/' + ${blog.getBookId()}}" class="btn btn-outline-info">编辑</a></td>
            <td><a th:href="@{'/admin/book/delete/' + ${blog.getBookId()}}" class="btn btn-outline-danger">删除</a></td>
        </tr>
        </tbody>
    </table>
</div>


<script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
</body>
</html>